package com.googlecode.scenemaker3d.model
{
	import com.googlecode.scenemaker3d.events.Position3DEvent;
	import com.googlecode.scenemaker3d.events.SelectedObject3DEvent;
	
	import flash.events.EventDispatcher;
	
	import mx.collections.ArrayCollection;
	
	import org.papervision3d.core.math.Number3D;
		
	[Event(name="selectedObject3D", type="events.SelectedObject3DEvent")]
	[Event(name="position3D", type="events.Position3DEvent")]
	
	[Bindable]	
	public class World3DModel extends EventDispatcher
	{
		
		public function World3DModel()
		{
			//CONSTRUCTOR	
		}
		//Cameras
		public var cameras:ArrayCollection;
		
		//Objects
		private var selVO:VO_Object3D = null;
		private var selVOPos:Number3D = new Number3D(0, 0, 0);
		
		public var objects:ArrayCollection;

		public var objID:uint = 0;
	
		//Timeline
		public var globalMarkerID:uint = 0;
		public var globalMarkers:ArrayCollection = new ArrayCollection();
		public var currentTimeInt:uint;
		public var keyFrameID:uint = 0;
		public var hideMarkerID:uint = 0;
		
		//Materials
		public var materials:ArrayCollection;
		
		public var matID:uint = 0;
				
		//Getters & setters
		[Bindable(event="selectedObject3D")]
		public function set selectedObject(selVO:VO_Object3D):void
		{
			this.selVO = selVO;
			if(selVO != null)
			{
				this.dispatchEvent(new SelectedObject3DEvent(SelectedObject3DEvent.SELECTED_OBJECT_3D, selVO));
			}
			
		}
		public function get selectedObject():VO_Object3D
		{
			return selVO;
		}
		
		[Bindable(event="position3D")]
		public function set selectedObjectPos(pos:Number3D):void
		{
			this.selVOPos = pos;
			this.dispatchEvent(new Position3DEvent(Position3DEvent.POSITION_3D, selVO));
		}
		public function get selectedObjectPos():Number3D
		{
			return selVOPos;
		}
	}
}